<?php
/** this page is responsible for fetching and prepping the information for the classes.

The data we will get is:

_SERVER["HTTP_USER_AGENT"]=Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0
_SERVER["HTTP_ACCEPT"]=text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,* / *;q=0.5
_SERVER["HTTP_ACCEPT_LANGUAGE"]=us,en;q=0.7,pt-br;q=0.3
_SERVER["HTTP_ACCEPT_ENCODING"]=gzip,deflate
_SERVER["HTTP_ACCEPT_CHARSET"]=ISO-8859-15,utf-8;q=0.7,*;q=0.7
_SERVER["REMOTE_ADDR"]=124.12.123.1
_SERVER["HTTP_REFERER"]
_SERVER["REQUEST_URI"] = url?xxx=3333
_SERVER["SCRIPT_NAME"] = url
_SERVER["REQUEST_TIME"]

with this we can figure out:
-platform
-browser
-languages
-charsets
-the IP
-where we came from
-where we are
-what time that happened
*/
class info{
	
	var $ua;
	var $lang;
	var $charset;
	var $ip;
	var $referer;
	var $url;
	var $time;
	var $query;

	function info(){
		$this->ua=$_SERVER["HTTP_USER_AGENT"];
		$this->lang=$this->splitter($_SERVER['HTTP_ACCEPT_LANGUAGE']);
		$this->charset=$this->splitter($_SERVER['HTTP_ACCEPT_CHARSET']);
		$this->ip=$_SERVER["REMOTE_ADDR"];
		$this->referer=$_SERVER["HTTP_REFERER"];
		$this->url=$_SERVER["SCRIPT_NAME"];
		$this->time=$_SERVER["REQUEST_TIME"];
		$this->query=$this->getQuery();
	}

	function getQuery(){
		return substr($_SERVER['REQUEST_URI'],strlen($_SERVER['SCRIPT_NAME'])+1);
	}
	/**
	This function is responsible for splitting the charset and language into an array
	*/
	function splitter($string){
		$split1 = explode(";",$string);
		$charset=array();
		foreach($split1 as $item){
			$split2 = explode(",",$item);
			foreach($split2 as $itm2){
				if(!strpos($itm2,"=")>0){
					array_push($charset,$itm2);
				}
			}
		}
		return $charset;
	}

	// CONVERT ID TO base 36
	function base36($x){
		$y=base_convert($x,10,36);
		return $y;
	}
	// CONVERT ID TO base 36
	function base10(){
		$y=base_convert($x,36,10);
		return $y;
	}

	


}
?>